<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function test(){
				var age = document.getElementById("age").value;
				if (isNaN(age)) {
					alert("你输入年龄不是一个数字")
					return false;
				} else{
					return true;
					
				}
			}
		</script>
	</head>
	<body>
		<form onsubmit="return test()" action="1.html">
			年龄:<input type="text" id="age"/>
			<input type="submit" name="" id="" value="提交" />
		</form>
		<script>
			//alert('1+2');
			alert(eval('1+2'));
		</script>
	</body>
</html>
